prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datarootdir = @datarootdir@
mandir = @mandir@
sdlappdatadir = $(datarootdir)/logstalgia
sdlappfontdir = @sdlappfontdir@

SUBDIRS = src

all:
	for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} all ); done

install: all
	mkdir -p -m 755 $(DESTDIR)/$(bindir)
	mkdir -p -m 755 ${DESTDIR}/$(sdlappdatadir)
	mkdir -p -m 755 ${DESTDIR}/$(mandir)/man1
	cp data/*.tga ${DESTDIR}/$(sdlappdatadir)/
	cp data/example.log ${DESTDIR}/$(sdlappdatadir)/
	cp logstalgia ${DESTDIR}/$(bindir)/
	sed 's|SDLAPP_RESOURCE_DIR|$(sdlappdatadir)|g' data/logstalgia.1 > ${DESTDIR}/$(mandir)/man1/logstalgia.1
	gzip -f9 ${DESTDIR}/$(mandir)/man1/logstalgia.1
ifndef sdlappfontdir
	mkdir -p -m 755 ${DESTDIR}/$(sdlappdatadir)/fonts
	cp data/fonts/*.ttf ${DESTDIR}/$(sdlappdatadir)/fonts/
	cp data/fonts/README ${DESTDIR}/$(sdlappdatadir)/fonts/
endif
distclean:
	for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} distclean ); done
	rm Makefile
	rm config.status
	rm config.log
clean:
	for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} clean ); done	
	if test -f logstalgia; then rm logstalgia; fi;
